Sending information back from delegate [iPhone]

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-06-17T17:21:14Z Indexed on 2010/06/17 17:23 UTC
Read the original article Hit count: 261

Filed under:
|
|

I'm using NSXMLParser in my RootViewController.m file.

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:response_data];
[xmlParser setDelegate:self];
[xmlParser parse];
[xmlParser release];

I'm also implementing this method to add entries to a dictionary defined in RootViewController.m for later use:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict

However, I'd like to get more than one XML file and do different things when the file has finished; this sounds like I need to use external files as delegates. My question is:

If I have the following implementation files (& their header files):

  • RootViewController.m
  • XMLDelegate1.m
  • XMLDelegate2.m

and set the ith NSXMLParser delegate to be XMLDelegatei.m, and get those files to return an NSDictionary that I can then add to the NSDictionary defined in RootViewController.m.

I guess there are two methods of doing this:

  1. Use a method that I don't know about; or
  2. Use a better workflow

I suspect it's 2, but hope it's 1.

Thanks, Andy

© Stack Overflow or respective owner

Related posts about iphone

Related posts about delegates